if the castNum of sprite 10 = the number of cast "Query" then
appendText(userKey)
pass()
exit
end if
end if
else
set the soundLevel to value(userKey)
dontPassEvent()
exit
end if
end if
if fortuneTeller() then
if userKey = RETURN then
if the visible of sprite gOkaySprite = 1 then
dontPassEvent()
exit
else
if the frame >= label("Love") then
if pressButton(gOkaySprite - 1, 1) then
set the visible of sprite gOkaySprite to 1
set the visible of sprite (gOkaySprite + 1) to 1
go("Categories")
end if
dontPassEvent()
exit
else
if the frame >= label("Glow") then
pass()
else
if the frame >= label("Query") then
if pressButton(gOkaySprite - 1, 1) then
setFortuneFrame()
end if
dontPassEvent()
else
pass()
exit
end if
end if
end if
end if
else
if the castNum of sprite 10 = the number of cast "Query" then
if (userKey >= "A") and (userKey <= "Z") then
appendText(userKey)
pass()
exit
end if
if (userKey = " ") or (userKey = "-") or (userKey = "/") or (userKey = ".") or (userKey = "!") or (userKey = "?") or (userKey = ":") or (userKey = ";") then
appendText(userKey)
pass()
exit
end if
if charToNum(userKey) = 8 then
deleteText(userKey)
pass()
exit
end if
dontPassEvent()
end if
end if
end if
end
on appendText userKey
set query to the text of cast "Query"
if the number of chars in query < 60 then
set the text of cast "Query" to query & userKey
updateStage()
else
playSound("Locker")
end if
end
on deleteText userKey
if charToNum(userKey) = 8 then
set query to the text of cast "Query"
delete char -30000 of query
set the text of cast "Query" to query
updateStage()
end if
end
on programmersKey
return the shiftDown and the controlDown
end
on fortuneTeller
return the frame >= gFortuneTeller
end
on delayFor howLong, interrupt
set howLong to howLong + the timer
if voidp(interrupt) then
repeat while the timer < howLong
nothing()
end repeat
else
repeat while (the timer < howLong) and the mouseUp
nothing()
end repeat
if interrupt > 0 then
puppetTransition(0)
go(interrupt)
end if
end if
end
on checkRange originalNumber, minValue, maxValue
if originalNumber < minValue then
set originalNumber to minValue
else
if originalNumber > maxValue then
set originalNumber to maxValue
end if
end if
return originalNumber
end
on checkRangeWrap originalNumber, minValue, maxValue
if originalNumber < minValue then
set originalNumber to maxValue - (minValue - originalNumber) + 1
else
if originalNumber > maxValue then
set originalNumber to minValue + (originalNumber - maxValue) - 1
end if
end if
return originalNumber
end
on setProp startSprite, stopSprite, whichProperty, whichValue
repeat with x = startSprite to stopSprite
do("set the " & whichProperty & " of sprite x=whichValue")
end repeat
end
on legalButton whichSprite
repeat while the mouseDown
nothing()
end repeat
return 1
end
on pressButton whichSprite, ignoreRollOver
repeat with x = 224 down to 217
set the foreColor of sprite whichSprite to x
updateStage()
end repeat
if programmersKey() then
set the loc of sprite whichSprite to point(the locH of sprite whichSprite + 1, the locV of sprite whichSprite + 1)
updateStage()
set the loc of sprite whichSprite to point(the locH of sprite whichSprite + 1, the locV of sprite whichSprite + 1)
updateStage()
end if
set delayFor to the timer + 20
repeat while the mouseDown or (the timer < delayFor)
nothing()
end repeat
if voidp(ignoreRollOver) then
set theResult to rollOver(whichSprite)
else
set theResult to ignoreRollOver
end if
repeat with x = 218 to 224
set the foreColor of sprite whichSprite to x
updateStage()
delay(5)
end repeat
set the foreColor of sprite whichSprite to 255
updateStage()
if programmersKey() then
set the loc of sprite whichSprite to point(the locH of sprite whichSprite - 1, the locV of sprite whichSprite - 1)
updateStage()
set the loc of sprite whichSprite to point(the locH of sprite whichSprite - 1, the locV of sprite whichSprite - 1)
updateStage()
end if
return theResult
end
on setFortuneFrame
if gFortuneCategory > 0 then
set query to the text of cast "Query"
set queryWord1 to word 1 of query
if queryWord1 = EMPTY then
exit
else
if (queryWord1 = "Why") or (queryWord1 = "Why?") then
go("Why not?")
exit
else
if query contains "you" then
set youMatch to 0
repeat with x = 1 to the number of words in query
if (word x of query = "you") or (word x of query = "your") or (word x of query = "yourself") then
set youMatch to 1
exit repeat
end if
end repeat
if youMatch = 1 then
go("I'm not sure.")
exit
end if
end if
end if
end if
if not listp(gFortuneFrame) then
set gFortuneFrame to []
end if
set theCount to count(gFortuneFrame)
if programmersKey() then
if (theCount = 0) or (theCount < gFortuneCategory) then
set newFrame to random(2) + 7
else
set oldFrame to getAt(gFortuneFrame, gFortuneCategory)
if oldFrame = 0 then
set newFrame to random(2) + 7
else
if (oldFrame < 8) or (oldFrame > 9) then
set newFrame to 8
else
set newFrame to oldFrame + 1
end if
end if
end if
set whichCategory to getAt(["Love", "Career", "Family", "Fame"], gFortuneCategory)
else
if the number of cast "FT1.5" < 1 then
set newFrame to random(4)
else
set newFrame to random(7)
end if
set whichCategory to getAt(["Love", "Career", "Fame", "Family"], gFortuneCategory)
end if
setAt(gFortuneFrame, gFortuneCategory, newFrame)
set whichFrame to label(whichCategory) + newFrame - 1